export default (lazy) => {
    return {
    	name:'lazy-compont',
        props: {
            tag: {
                type: String,
                default: 'div'
            }
        },
        data() {
            return {
                state: {
                    loaded: false
                },
                rect: {},
                show: false
            }
        },
        created:function(){
            console.log("create",this.show)
        },
        mounted () {
            // lazy.addLazyBox(this)
            // lazy.lazyLoadHandler();
        },
        methods: {
            getRect() {
                this.rect = this.$el.getBoundingClientRect();
            },
            checkInView() {
                return inBrowser &&
                    (this.rect.top < window.innerHeight * lazy.options.preLoad && this.rect.bottom > 0) &&
                    (this.rect.left < window.innerWidth * lazy.options.preLoad && this.rect.right > 0)
            },
            load() {
                console.log("显示吧~~")
                this.show = true
                this.$emit('show', this)
            }
        }
    }
}
